<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Rosbag demo">

    <title>Rosbag Extract Tool</title>

    <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">

    <script type="text/javascript" src="//code.jquery.com/jquery-2.1.1.js"></script>
    <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>

    <!-- Script to instantly classify an image once it is uploaded. -->
    <script type="text/javascript">
      $(document).ready(
        function(){

          $('#rosbagfile').change(
            function(){
              if ($(this).val()){
                $('#rosupload').submit();
              }
            }
          );

          $('#realsense_get').click(
            function(e) {
              $.get("50.227.54.146:9000/capture", function (data, status) {
                alert("Data: " + data + "\nStatus: " + status)
              })
            }
          );

        }
      );
    </script>

    <style>
    body {
      font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
      line-height:1.5em;
      color: #232323;
      -webkit-font-smoothing: antialiased;
    }
    h1, h2, h3 {
      font-family: Times, serif;
      line-height:1.5em;
    }
    </style>
  </head>

  <body>
    <!-- Begin page content -->
    <div class="container">
      <div class="page-header">
        <h1><a href="/">ROSBAG Metadata Extract</a></h1>
      </div>


      <div id="realsense">
      <div class="container">
        {% if has_depth_result %}
        <div class="media">
          <p>Original Image</p>
          <a class="pull-left" href="#"><img class="media-object" src = {{ new_color_src }}></a>
        </div>
	<div class="media">
          <p>Depth Image</p>
          <a class="pull-left" href="#"><img class="media-object" src = {{ depth_color_src }}></a>
        </div>
        <div class="media">
          <p>Cropped by Depth</p>
          <a class="pull-left" href="#"><img class="media-object" src = {{ cropped_src }}></a>
        </div>
	<div class="media">
          <p>Depth Complete</p>
          <a class="pull-left" href="#"><img class="media-object" src = {{ complete_src }}></a>
        </div>
        <div class="media">
          <p>Depth Visualization</p>
          <a class="pull-left" href="#"><img class="media-object" src = {{ depth_vis_src }}></a>
        </div>
        {% endif %}

        <form action="realsense" method="post">
          <input type="submit" value="capture from realsense (testing)" />
        </form>
        <hr>


        <form id="rosupload" class="form-inline" role="form" action="rosbagupload" method="post" enctype="multipart/form-data">
          <div class="form-group">
            <label for="rosbagfile">Upload a ROSBAG file:</label>
            <input type="file" name="rosbagfile" id="rosbagfile">
          </div>
        </form>

        {% if has_rosbag_result %}
        <hr>
        <div>
          <h3>File data for {{filename}}:</h3>
          <p>File version: {{ fileversion }}</p>
          <p>Depth FPS: {{depth_fps}}</p>
          <p>Depth encoding: {{depth_encoding}}</p>
          <p>Depth size: {{depth_size}}</p>
          <p>Color FPS: {{color_fps}}</p>
          <p>Color encoding: {{color_encoding}}</p>
          <p>Color size: {{color_size}}
          <p>Stereo baseline (dist between sensors in mm): {{stereo_baseline}}</p>
        </div>
        {% endif %}

      </div>
    </div>

    <hr>
    <div id="footer">
      <div class="container">
        <p>Extract tool for ROSBAG files</p>
      </div>
   </div>
 </body>
</html>
